package controllers

import (
	"fmt"
	"github.com/astaxie/beego"
	"home/models"
)

type SearchController struct {
	beego.Controller
}

func (this *SearchController) Get() {
	this.TplName="search.tpl"
	searchValue := this.Ctx.Input.Param(":search_value")
	fmt.Print("搜索结果:",searchValue)
	// 获取菜单数据
	var datalist []models.HomeMenu
	datalist, err := models.GetMenu()
	if err != nil {
		beego.Error(err)
	}
	this.Data["Menu"] = datalist

		// 获取热门影片
	var searchData []models.Video
	searchData, err = models.GetSearchVideo(searchValue)
	if err != nil {
		beego.Error(err)
	}
	this.Data["SearchData"] = searchData


}
